/*POP地区联动*/

function setNetwordData(item,options){
	if(item == ''){
	   return false; 
	}
	console.log(item)
	/*本段数据*/
	if(item.type == 3){ //公有云
		var demo1 = $("select[name='cloud_country']");
		var loading = options.layer.load(1,{shade:[0.1,'#fff']});
		_post(options.getClouList,{pid:item.local_cloud_id},function(res){
			options.layer.close(loading);
			if(res.code == 1){
				$.each(res.items,function(i,d){
	                if(item.country_id == d.id){
	                    $(demo1).append("<option value='"+d.id+"' selected data-icon='"+(d.icon !='' ? d.icon : '')+"' >"+d.name+"</option");
	                }else{
	                    $(demo1).append("<option value='"+d.id+"' data-icon='"+(d.icon !='' ? d.icon : '')+"' >"+d.name+"</option")
	                }
	            })

	            $(".type").hide(); 
	            $(".type-publc").show(); 
	            $(".type-publcc").attr('lay-verify',"required");
	            $(".type-datacenter").removeAttr('lay-verify');
				setACloudUser(item.local_cloud_id)
	            options.form.render();
	            if(item.country_id > 0) 
	            {
	            	var doems2 = $("select[name='cloud_city']");
	            	var loading = options.layer.load(1,{shade:[0.1,'#fff']});
	            	_post(options.getCloudCity,{country_id:item.country_id,cloud_id:item.local_cloud_id},function(res){
	            		options.layer.close(loading);
	            		if(res.code == 1){
		            		$.each(res.items,function(i,d){
				                if(item.city_id == d.id){
				                    $(doems2).append("<option value='"+d.id+"' selected >"+d.name+"</option");
				                }else{
				                    $(doems2).append("<option value='"+d.id+"'>"+d.name+"</option")
				                }
				            })
				            options.form.render();
				            /*数据中心*/
				            if(item.city_id > 0){
				            	var doem3 = $("select[name='cloud_conter']");
				            	var loading = options.layer.load(1,{shade:[0.1,'#fff']});
				            	_post(options.getCloudItems,{country_id:item.country_id,cloud_id:item.local_cloud_id,city_id:item.city_id},function(res){
				            		options.layer.close(loading);
				            		if(res.code == 1){
				            			$.each(res.items,function(i,d){
							                if(item.cloud_conter == d.id){
							                    $(doem3).append("<option value='"+d.id+"' selected >"+d.name+"</option");
							                }else{
							                    $(doem3).append("<option value='"+d.id+"'>"+d.name+"</option")
							                }
							            })
							            options.form.render();
				            		}
				            	})
				            }
			        	}
	            	})
	            }
			}
		})
	}else{ //数据中心
		var _doem4 = $("select[name='city_id']");
		var loading = options.layer.load(1,{shade:[0.1,'#fff']});
		_post(options.popList,{pid:item.country_id},function(res){
	        //$("input[name='access_addr']").val('')
	        options.layer.close(loading);
	        if(res.code == 1){
	            $.each(res.items,function(i,d){
	                if(item.city_id == d.id){
	                    $(_doem4).append("<option value='"+d.id+"' selected >"+d.name+"</option");
	                }else{
	                    $(_doem4).append("<option value='"+d.id+"'>"+d.name+"</option")
	                }
	            })
	            options.form.render();
	            if(item.city_id > 0){
	            	var _doems5 = $("select[name='pop_id']");
	            	var loading = options.layer.load(1,{shade:[0.1,'#fff']});
	            	_post(options.popItems,{area_id:item.country_id,city_id:item.city_id},function(res){
	            		options.layer.close(loading);
	            		$.each(res.items,function(i,d){
			                if(item.pop_id == d.id){
			                    $(_doems5).append("<option value='"+d.id+"' selected >"+d.name+"</option");
			                }else{
			                    $(_doems5).append("<option value='"+d.id+"'>"+d.name+"</option")
			                }
			            })
			            options.form.render();
	            	})
	            }
	            
	        }
	    })
	}
	/*对端数据*/
	if(item.endtype == 3){ //公有云
		var _demo6 = $("select[name='endcloudaddrid']");
		var loading = options.layer.load(1,{shade:[0.1,'#fff']});
		_post(options.getClouList,{pid:item.endcloudid},function(res){
			options.layer.close(loading);
			if(res.code == 1){
				$.each(res.items,function(i,d){
	                if(item.endcloudaddrid == d.id){
	                    $(_demo6).append("<option value='"+d.id+"' selected data-icon='"+(d.icon!='' ? d.icon : '')+"' >"+d.name+"</option");
	                }else{
	                    $(_demo6).append("<option value='"+d.id+"' data-icon='"+(d.icon!='' ? d.icon : '')+"' >"+d.name+"</option")
	                }
	            })
	            $(".etype").hide(); 
				$(".etype-publc").show(); 
				$(".etype-datacenter").removeAttr('lay-verify');
				$(".etype-publcc").attr('lay-verify',"required");
	            setZCloudUser(item.endcloudid);
	            options.form.render();
	            if(item.endcloudaddrid > 0)
	            {
	            	var _doems7 = $("select[name='ecloud_city']");
	            	var loading = options.layer.load(1,{shade:[0.1,'#fff']});
	            	_post(options.getCloudCity,{country_id:item.endcloudaddrid,cloud_id:item.endcloudid},function(res){
	            		options.layer.close(loading);
	            		if(res.code == 1){
		            		$.each(res.items,function(i,d){
				                if(item.ecity_id == d.id){
				                    $(_doems7).append("<option value='"+d.id+"' selected >"+d.name+"</option");
				                }else{
				                    $(_doems7).append("<option value='"+d.id+"'>"+d.name+"</option")
				                }
				            })
				            options.form.render();
				            /*数据中心*/
				            if(item.ecity_id > 0){
				            	var doem8 = $("select[name='ecloud_conter']");
				            	var loading = options.layer.load(1,{shade:[0.1,'#fff']});
				            	_post(options.getCloudItems,{country_id:item.endcloudaddrid,cloud_id:item.endcloudid,city_id:item.ecity_id},function(res){
				            		options.layer.close(loading);
				            		if(res.code == 1){
				            			$.each(res.items,function(i,d){
							                if(item.ecloud_conter == d.id){
							                    $(doem8).append("<option value='"+d.id+"' selected >"+d.name+"</option");
							                }else{
							                    $(doem8).append("<option value='"+d.id+"'>"+d.name+"</option")
							                }
							            })
							            options.form.render();
				            		}
				            	})
				            }
			        	}
	            	})
	            }
			}
		})
	}else{
		var _doem9 = $("select[name='ecity_id']");
		var loading = options.layer.load(1,{shade:[0.1,'#fff']});
		_post(options.popList,{pid:item.ecountry_id},function(res){
			options.layer.close(loading);
	        //$("input[name='access_addr']").val('')
	        if(res.code == 1){
	            $.each(res.items,function(i,d){
	                if(item.ecity_id == d.id){
	                    $(_doem9).append("<option value='"+d.id+"' selected >"+d.name+"</option");
	                }else{
	                    $(_doem9).append("<option value='"+d.id+"'>"+d.name+"</option")
	                }
	            })
	            options.form.render();
	            if(item.ecity_id > 0){
	            	var _doems10 = $("select[name='epop_id']");
	            	var loading = options.layer.load(1,{shade:[0.1,'#fff']});
	            	_post(options.popItems,{area_id:item.country_id,city_id:item.city_id},function(res){
	            		options.layer.close(loading);
	            		$.each(res.items,function(i,d){
			                if(item.epop_id == d.id){
			                    $(_doems10).append("<option value='"+d.id+"' selected >"+d.name+"</option");
			                }else{
			                    $(_doems10).append("<option value='"+d.id+"'>"+d.name+"</option")
			                }
			            })
			            options.form.render();
	            	})
	            }
	            
	        }
	    })
	}
}